
#pragma once

#include <list>
#include <string>
#include "buffer.h"

class DeviceTest {
public:
    DeviceTest();
    virtual ~DeviceTest();

    // bool runTest();
    bool runTest(const char * testName = NULL);

    void setFd(int fd);
    void addTestCase(const char * name, unsigned char * command, int command_len, unsigned char * respnose, int response_len);

    class Listener {
    public:
        virtual void onTestCaseResult(const char * name, unsigned char * expected, int expected_len, unsigned char * real, int real_len) = 0;
    };
    void setListener(Listener* listener) { mListener = listener; }

private:
    class TestCase {
    public:
        std::string name;
        serial::Buffer command;
        serial::Buffer response;
    };
    std::list<TestCase*> mTestCases;
    int mFd;
    Listener* mListener;
    void runCase(TestCase* tc);
};


